//
//#include "../../User.h"
//#include "inbound.h"
//#include "../../game/CBaseSpace.h"
//
//namespace ProjectZ { namespace NCommand { namespace NInbound {
//
//
//
//void SS_CHECK_BATTLE_LATENCY::OnExecute(User * pUser, ::Network::Packet * pPacket)
//{
//	//STRESSLOG("[CHANNEL] SS_CHECK_BATTLE_LATENCY::ONEXECUTE");
//
////	PREPARE_PACKET;
////
////	if( pUser->latency_info.state == LATENCYFLAG_ON )
////	{
////		FILELOG("A");
////		return;
////	}
////
////	// checked once, but do it again.
////	if( pUser->player_info.Locate != ProjectZ::PL_PK &&
////		pUser->player_info.Locate != ProjectZ::PL_PVP_FRIENDLY &&
////		pUser->player_info.Locate != ProjectZ::PL_PVP_QUICK )
////	{
////		FILELOG("B");
////		return;
////	}
////
////	::ProjectZ::NGame::CBaseSpace *pSpace = pUser->GetSpace();
////
////	//
//////	if( (::NF::GetTickCount() - pSpace->starttick) <= 1000 * 10 )
//////	{
//////		FILELOG("C");
//////		return;
//////	}
//////
//////
//////	if( pSpace->bFristMovePacket == false )
//////	{
//////		FILELOG("E");
//////		return;
//////	}
////
////	if( pSpace->bStartFight == false )
////	{
////		FILELOG("F");
////		return;
////	}
////
////	if( pSpace->pLatencyUser.find(pUser->GetGID()) == pSpace->pLatencyUser.end() )
////	{
////		pSpace->pLatencyUser[pUser->GetGID()] = pUser;
////		pUser->latency_info.state = LATENCYFLAG_ON;
////	}
////	else
////	{
////		FILELOG("D");
////		return;
////	}
////
////	FILELOG("[SS_CHECK_BATTLE_LATENCY] GID=%d, user_seq=%d", pUser->GetGID(), pUser->GetUserSeq());
////
////
////	//
////	::Network::Packet * pNoti = ::Network::GETPACKETPOOL()->SEND_NEW();
////	pNoti->MsgCat("%c", pSpace->pLatencyUser.size());
////
////	std::map<int, User *>::iterator itr = pSpace->pLatencyUser.begin();
////	for( ; itr != pSpace->pLatencyUser.end() ; itr++ )
////	{
////		pNoti->MsgCat("%d", (*itr).first);
////	}
////
////	pNoti->MsgCat("%d", GetChiefGID(pUser));
////	pNoti->MakePacket(CMD_SC_BATTLE_LATENCY_START);
////
////	pSpace->SendToMessageExceptMe(pNoti, pUser->GetGID());
//}
//
//
//int SS_CHECK_BATTLE_LATENCY::GetChiefGID(User *pUser)
//{
////	NGame::CBaseSpace *pSpace = pUser->GetSpace();
////	NGame::CBaseSpace::PLAYERTREE &playerTree = pSpace->GetPlayerTree();
////
////	if (true == playerTree.empty())
////	{
////		FILELOG("SS_CHECK_BATTLE_LATENCY:WARNING:%s: no users in space", __func__);
////		return 0;
////	}
////
////	::ProjectZ::NGame::CBaseSpace::CITR citr = playerTree.begin();
////	for( ; citr != playerTree.end() ; citr++ )
////	{
////		User *pOtherUser = (*citr).second;
////
////		if( pOtherUser->GetGID() == pUser->GetGID() )
////			continue;
////
////		if( pOtherUser->latency_info.state == LATENCYFLAG_OFF )
////		{
////			FILELOG("SS_CHECK_BATTLE_LATENCY:%s: new chief gid %d", __func__, pOtherUser->GetGID());
////			return pOtherUser->GetGID();
////		}
////	}
////
////	FILELOG("WARNING:%s: no users to get chief", __func__);
//
//	return 0;
//}
//
//
//} /*NInbound*/ } /*NCommand*/ } /*ProjectZ*/
